//
//  HTRegisterLineHeader.m
//  TruckDriver
//
//  Created by Ting Han on 2017/9/28.
//  Copyright © 2017年 Ting Han. All rights reserved.
//

#import "HTRegisterLineHeader.h"
@interface HTRegisterLineHeader()
@property (weak, nonatomic) IBOutlet UILabel *driverLabel;
@property (weak, nonatomic) IBOutlet UILabel *truckLabel;
@property (weak, nonatomic) IBOutlet UIView *firstView;
@property (weak, nonatomic) IBOutlet UILabel *firstLabel;
@property (weak, nonatomic) IBOutlet UIView *secondView;
@property (weak, nonatomic) IBOutlet UILabel *secondLabel;
@property (weak, nonatomic) IBOutlet UIView *lineView;

@end
@implementation HTRegisterLineHeader
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
         self = [[NSBundle mainBundle]loadNibNamed:@"HTRegisterLineHeader" owner:self options:nil][0];
        self.firstView.layer.masksToBounds = YES;
        self.firstView.layer.cornerRadius = self.firstView.frame.size.width/2;
        self.firstView.layer.borderWidth = 2;
        self.secondView.layer.masksToBounds = YES;
        self.secondView.layer.cornerRadius = self.secondView.frame.size.width/2;
        self.secondView.layer.borderWidth = 2;
    }
    return self;
}

- (void)awakeFromNib{
    [super awakeFromNib];
   
}
- (void)setType:(RegisterLineHeaderType)type{
    _type = type;
    switch (type) {
        case RegisterLineHeaderTypeOne:
            {
                [self setType1Color:kBlueColor];
                [self setType2Color:kMainGrayColor];
            }
            break;
        case RegisterLineHeaderTypeTwo:
        {
            [self setType1Color:kBlueColor];
            [self setType2Color:kBlueColor];
        }
        default:
            break;
    }
}
- (void)setType1Color:(UIColor *)color{
    self.driverLabel.textColor = color;
    self.firstView.layer.borderColor = color.CGColor;
    self.firstLabel.textColor = color;
}
- (void)setType2Color:(UIColor *)color{
    self.truckLabel.textColor = color;
    self.secondView.layer.borderColor = color.CGColor;
    self.secondLabel.textColor = color;
    self.lineView.backgroundColor = color;
}
@end
